<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style/base.css" type="text/css">
    <link rel="stylesheet" href="style/global.css" type="text/css">
    <link rel="stylesheet" href="style/header.css" type="text/css">
    <link rel="stylesheet" href="style/goods.css" type="text/css">
    <link rel="stylesheet" href="style/common.css" type="text/css">
    <link rel="stylesheet" href="style/bottomnav.css" type="text/css">
    <link rel="stylesheet" href="style/footer.css" type="text/css">
    <link rel="stylesheet" type="text/css" href="style/bae.css" />
    <link rel="stylesheet" type="text/css" href="style/checkout.css" />
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/successsubmit.js"></script>
    <title>评价</title>
</head>

<body>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
    <span id="newheader"></span>
    <script src="js/newheader.js"></script>

    <div class="checkout-box-ft" style="width: 46%;margin-left: 28%;">
        <!-- 商品清单 -->
        <div id="checkoutGoodsList" class="checkout-goods-box">
            <div class="xm-box">
                <div class="box-hd">
                    <h2 class="title">待评价</h2>
                </div>
                <div class="box-bd" style="border:1px  solid  red">
                    <dl class="checkout-goods-list">
                        <dt class="clearfix">
                            <span class="col col-1">商品名称</span>
                            <span class="col col-2">购买价格</span>
                            <span class="col col-3">购买数量</span>
                        </dt>
                        <dd class="item clearfix" id="substance">
                            <div class="item-row">
                                <div class="col col-1">
                                    <div class="g-pic">
                                        <img id="newimage" src="../hengzhi-office/images/1.png" width="40px"
                                            height="40px" />
                                    </div>
                                    <div class="g-info">
                                        <a id="sname" href="#">碎纸机</a>
                                        <a id="numberhao" href="#" style="margin-left: 60px;">wx1603785786512656691</a>
                                    </div>
                                </div>
                                <div id="cost" class="col col-2">66</div>
                                <div id="sale" class="col col-3">1</div>
                            </div>
                        </dd>
                    </dl>
                </div>
            </div>
        </div>
    </div>


    <!--  评论表单 start-->
    <div style="margin-left: 22%;">
        <div class="comment_form mt20">
            <form action="" style="border:1px  solid  blue">
                <ul>
                    <li id="xli">
                        <label for=""> 评分：</label>
                        <input type="radio" name="grade" /> <strong class="star star5"></strong>
                        <input type="radio" name="grade" /> <strong class="star star4"></strong>
                        <input type="radio" name="grade" /> <strong class="star star3"></strong>
                        <input type="radio" name="grade" /> <strong class="star star2"></strong>
                        <input type="radio" name="grade" /> <strong class="star star1"></strong>
                    </li>

                    <li>
                        <label for="">评价内容：</label>
                        <textarea name="" id="neirong" cols="" rows=""></textarea>
                    </li>
                    <li>
                        <label for="">&nbsp;</label>



                    </li>
                </ul>

            </form>
            <input id="succ" style="border:1px  solid  red" type="submit" value="提交评论" class="comment_btn" />
        </div>
        <!--  评论表单 end-->
    </div>
    <span id="newfooter"></span>
    <script src="js/footer.js"></script>
    <script>
        var aaa = getUrlParam('newid');
        var ttt = getUrlParam('moreid')
        var serCmsData = localStorage.getItem('token');
        var url = 'http://hengzhi.ayvvv.com';
        $("#succ").click(function () {
            var dd = $("#neirong").val()
            if (dd) {
                console.log(dd)


                $.ajax({
                    url: url + '/api/reply/' + ttt,
                    type: 'post',
                    dataType: 'json',
                    async: true,
                    headers: {
                        "x-token": serCmsData
                    },
                    data: {
                        comment: dd,
                        pics: [],
                        postage_score: "4",
                        product_score: "4",
                        service_score: "4"
                    },
                    success: function (hahadata) {                  
                        swal("提交", "提交评价成功", 'success');
                        console.log(hahadata, "2222222222222222")
                        $("#neirong").val("")
                        var radios = $(":radio");
                        radios.eq(0).attr("checked", false)
                        radios.eq(1).attr("checked", false)
                        radios.eq(2).attr("checked", false)
                        radios.eq(3).attr("checked", false)
                        radios.eq(4).attr("checked", false)
                    }

                })
            } else {
                swal("失败", "不能为空", 'error');
            }

        })
        $.ajax({
            url: url + '/api/order/detail/' + aaa,
            type: 'get',
            dataType: 'json',
            async: true,
            headers: {
                "x-token": serCmsData
            },
            success: function (xidata) {
                console.log(xidata, "666")
                //获取单个商品的图片
                $("#newimage").attr("src", xidata.data.orderProduct[0].cart_info.product.image)
                //获取单个商品的订单号
                $("#numberhao").html(xidata.data.order_sn)
                //获取单个商品的名称
                $("#sname").html(xidata.data.orderProduct[0].cart_info.product.store_name)
                //获取单个商品的购买价格
                $("#cost").html(xidata.data.orderProduct[0].cart_info.product.price)
                //获取单个商品的个数
                $("sale").html(xidata.data.orderProduct[0].cart_info.product.product_num)

            }

        })


    </script>


</body>

</html>